package com.alcloud.springplus.domain;

import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @className: User
 * @description: 用户表
 * @author: AllG
 * @createDate: 2018-12-14 09:30:20
 * @updateRemark: 更新说明
 */
@Data
@Entity
@Table(name = "t_user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 主键Id
     */
    @Id
    @Column(name = "f_user_id", unique = true, nullable = false)
    @TableGenerator(name = "table_seq", pkColumnValue = "t_user", initialValue = 1, allocationSize = 10)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "table_seq")
    private Integer id;

    /**
     * 用户所属组织Id
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "f_org_id")
    private Org org;

    /**
     * 用户名
     */
    @Column(name = "f_username", nullable = false, length = 50)
    private String username;

    /**
     * 密码
     */
    @Column(name = "f_password", length = 128)
    private String password;

    /**
     * 加密混淆码
     */
    @Column(name = "f_salt", length = 32)
    private String salt;

    /**
     * 手机号码
     */
    @Column(name = "f_mobile", length = 100)
    private String mobile;

    /***/
    @Column(name = "f_email", length = 100)
    private String email;

    /**
     * 昵称
     */
    @Column(name = "f_nick_name", length = 100)
    private String nickName;

    /**
     * 性别
     * M:男
     * W:女
     */
    @Column(name = "f_gender", length = 1)
    private String gender;

    /**
     * 等级
     */
    @Column(name = "f_rank", nullable = false)
    private Integer rank;

    /**
     * 类型
     * 0：会员
     * 1：管理员
     */
    @Column(name = "f_type", nullable = false)
    private Integer type;

    /**
     * 状态
     * 0：正常
     * 1：锁定
     * 2：待验证
     */
    @Column(name = "f_status", nullable = false)
    private Integer status;

    /**
     * 创建时间
     */
    @Column(name = "f_create_time", nullable = false)
    @CreationTimestamp
    private Date createTime;

    /**
     * 创建人
     */
    @Column(name = "f_create_by")
    private Integer createBy;

    /***/
    @Column(name = "f_update_time")
    private Date updateTime;

    /**
     * 更新人
     */
    @Column(name = "f_update_by")
    private Integer updateBy;
}
